﻿using System;
using System.Linq;

public class CommandLineArgs
{
	public static string[] args;

	public static void Init(string[] args)
	{
		CommandLineArgs.args = args;
		string arg = "";
		int i;
		for (i = 0; i < args.Length; i++)
		{
			arg = arg + args[i] + ":\n\t";
			i++;
			if (i < args.Length)
			{
				arg += args[i];
			}
			arg += "\n";
		}
		Console.WriteLine("==================== 命令行参数 ====================");
		Console.WriteLine(arg);
	}

	public static string GetArgument(string name)
	{
		for (int i = 0; i < args.Length; i++)
		{
			if (args[i] == name && args.Length > i + 1)
			{
				return args[i + 1];
			}
		}
		return null;
	}

	public static bool HasArgument(string name)
	{
		return args.Contains(name);
	}
}
